Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive time-stepping for transient solver using SUNDIALS #292

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

simlapointe
Copy link

Add adaptive time-stepping capability for transient simulations. The default transient solver type remains a fixed time-stepping integrator, but the user can now use SUNDIALS implicit multistep (CVODE) and Runge-Kutta (ARKODE) integrators if desired.

@simlapointe simlapointe added enhancement New feature or request transient Related to driven simulations in the time domain labels Nov 6, 2024
Copy link
Collaborator

@hughcars hughcars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. There's a few smaller structural issues, but the two bigger things I am thinking about
a) Can the RUNGE_KUTTA option use instead the mfem internal time integrator? That way the sundials connection is really only used for the adaptivity. This would slightly tidy the interface for adaptivity, along with making the non-adaptive slightly more fully featured. There are some SDIRK options in there that would probably be good choices.
b) Is there a way to compute B implicit to this process?

I have some of my suggestions on hughcars/transient-adapt-dt if you want to take a look.

cmake/ExternalSUNDIALS.cmake Outdated Show resolved Hide resolved
Comment on lines 43 to 54
if(PALACE_WITH_CUDA)
list(APPEND SUNDIALS_OPTIONS
"-DENABLE_CUDA=ON"
)
endif()

if(PALACE_WITH_MAGMA)
list(APPEND SUNDIALS_OPTIONS
"-DENABLE_MAGMA=ON"
"-DMAGMA_DIR=${MAGMA_DIR}"
)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What tests have you done with CUDA/MAGMA builds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried building with CUDA/MAGMA and SUNDIALS' ENABLE_MAGMA was causing a build failure. I removed it and Palace builds without issues but I'm getting NaNs at step 0 of the transient solve. Will try to understand what's going wrong. It happens even with generalized alpha, so I don't think it's SUNDIALS related.

docs/src/config/solver.md Outdated Show resolved Hide resolved
palace/models/timeoperator.cpp Show resolved Hide resolved
palace/models/timeoperator.cpp Outdated Show resolved Hide resolved
palace/models/timeoperator.cpp Outdated Show resolved Hide resolved
Comment on lines 391 to 392
En += E;
Curl->AddMult(En, B, -0.5 * dt);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to be computing B as part of this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. We solve the ODE system for E and Edot, not sure how else to get B.

palace/models/timeoperator.cpp Outdated Show resolved Hide resolved
palace/models/timeoperator.cpp Outdated Show resolved Hide resolved
cmake/ExternalMFEM.cmake Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request transient Related to driven simulations in the time domain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants